package cn.xmy.demo01.dao;




import cn.xmy.demo01.pojo.Address;
import org.apache.ibatis.annotations.Mapper;

import java.sql.SQLException;
import java.util.List;
@Mapper
public interface AddressDao {
    //查询所有
    List<Address> findAllAddress() throws SQLException, ClassNotFoundException;
    //增加
    int addAddress(Address address) throws SQLException, ClassNotFoundException;
    //修改
    int updateAddress(Address address)throws SQLException, ClassNotFoundException;
    // 删除
    int deleteAddress(String id)throws SQLException, ClassNotFoundException;
    //根据id查书
    Address findAllAddressById(String id) throws SQLException, ClassNotFoundException;
    //是否存在默认地址
    int isDefaultAddress(String id) throws SQLException, ClassNotFoundException;
    //显示默认地址
    Address getDefaultAddress(String id) throws SQLException, ClassNotFoundException;
    //修改默认为非默认
    void resetDefaultAddresses(); // 将所有地址的 isDefault 设为 0
    void setDefaultAddress(String id); // 将指定 ID 的地址设为 1
    //查询isDefault为1的地址
    List<Address> findDefaultAddress() throws SQLException, ClassNotFoundException;
}
